package com.foreknow.mapping;

import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;

public class MappingFactory {
    private static MappingFactory mappingFactory = null;
    private Map<String, EntityMapping> map = new HashMap<>();
    public static final String USER_MAPPING = "userMapping";
    public static final String GUESTBOOK_MAPPING = "guestBookMapping";

    private MappingFactory(){

    }

    public static MappingFactory getInstance(){
        if (mappingFactory == null){
            mappingFactory = new MappingFactory();
            mappingFactory.map.put(USER_MAPPING, new UserMapping());
            mappingFactory.map.put(GUESTBOOK_MAPPING, new GuestBookMapping());
        }
        return mappingFactory;
    }

    public EntityMapping getMap(String key){
        return map.get(key);
    }
}
